package com.itheima.demo.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author :WuJunJie
 * packageName :com.example.demo.aspect
 * fileName :Aspect
 * creationTime :2022-11-11 9:49
 */
//@Component
//@Aspect
public class AOP {
//    @Pointcut("execution(void com.itheima.demo.controller.AOPController.six())")
//    @Pointcut("execution(* com..*(..))")

//   @Pointcut("execution(* com..*(..)) &&!execution(* com..six())")
    public void six(){}

//    @Before("six()")
    public void before(){

        System.out.println("我先执行了");

    }
//    @After("six()")
    public void after(){
        System.out.println("我后被执行了");
    }

//    @Around("six()")
    public void around(ProceedingJoinPoint pjp) throws Throwable {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            pjp.proceed();
        }
        long end = System.currentTimeMillis();
        System.out.println("万次测试:"+(end-start));
    }

}
